package interviewpreparationkit.array

import org.junit.jupiter.api.Test
import java.util.*
import kotlin.test.assertEquals

class RotLeftTests {
    @Test
    fun rotLeftTest() {

        val scan = Scanner(RotLeftTests::class.java.getResourceAsStream("/rotLeft.txt"))
        while (scan.hasNextLine()) {
            val nd = scan.nextLine().split(" ")

            val n = nd[0].trim().toInt()

            val d = nd[1].trim().toInt()

            val a = scan.nextLine().split(" ").map { it.trim().toInt() }.toTypedArray()

            val result = rotLeft(a, d)

            val expect = scan.nextLine().split(" ").map { it.trim().toInt() }.toTypedArray()

            println(result.joinToString(" "))

            assertEquals(expect.joinToString(" "), result.joinToString(" "))
        }
    }
}